<?php
/**
 * Created by PhpStorm.
 * User: shiding
 * Date: 2019-06-24
 * Time: 17:03
 */

namespace App\Http\Repositories;

use App\Models\Project;

class ProjectRepository
{
    protected $projectModel;

    public function __construct(Project $project)
    {
        $this->projectModel = $project;
    }

    public function getList($params)
    {
        return $this->projectModel->getPorjectList($params);
    }

    public function edit($params, $id = 0)
    {
        return $id
            ? $this->projectModel->insert($params)
            : $this->projectModel->where("id", $id)->update($params);
    }

    public function del($id)
    {
        return $this->projectModel->destroy($id);
    }
}